<html>
<body id="test_view">

	<div id="container">
	
		<div class="bubble">
			<div class="rectangle"><h2 class="nero">I'm The Best</h2></div>
			<div class="triangle-l"></div>
			<div class="triangle-r"></div>
			<div class="info">
				<?php isset($_SESSION['user']) ? $student = $this->users->get_student($_SESSION['user']): ''; ?>
				<h2> <? echo $student['student_name']?> </h2> <br>
				<ul>
					<li> Username : <? echo $student['username']?> </li>
					<li> Kelas : <? echo $student['class_name']?> </li>
					<li> Kelas : <? echo $student['absent']?> </li>
				</ul>
			</div>
		</div>
	</div>

		<? 
			$counter = 1;
			if(count($tests) > 0 ) : 
				$daftar_ujian = "";
				foreach($tests as $row){
					$subject_name = $this->subjects->get_name($row["subject_id"]);
					$temp_arr = explode(',',$row['question_id']);
					$chapter_name = "";
					for($i=0; $i<count($temp_arr); $i++){
						$chapter_name .= $this->tests->get_chapter_name($temp_arr[$i]);
						if($i < count($temp_arr)-1)
							$chapter_name .= ", ";
					}
					
					$temp_arr = explode(',',$row['percentage']);
					$percentage = "";
					for($i=0; $i<count($temp_arr); $i++){
						$percentage .= $temp_arr[$i];
						if($i < count($temp_arr)-1)
							$percentage .= ", ";
					}
					$search = array("<p>","</p>");
					$row['information'] = str_replace($search, "",$row['information']);
			
					$daftar_ujian .= $counter. ". " . anchor('student/tests/start_test/'. $row['id'],$row['information']) . "<br />"; 
					$counter++;
				}
		?>
			<div id="wrapper">
            	<ul id="index_cards">
                	<li id="card-1">
                    	<h3>Aturan Ujian</h3>
                        <img src="<?php echo base_url() . 'assets/'; ?>images/t9tuqui_trans.png" height="130" width="130" alt="Toucan" /> <br />
						<p>
						1. Siswa dapat melewati soal yang dianggap sulit dengan menggunakan tombol skip. <br />
						2. Ujian akan otomatis berhenti jika waktu pengerjaan ujian sudah selesai. <br />
						</p>
                    </li>
                    <li id="card-2">
                    	<h3>Daftar Ujian</h3>
                    	<img src="<?php echo base_url() . 'assets/'; ?>images/t9foxy_trans.png" height="130" width="130" alt="Fox" />
                    	<p><? echo $daftar_ujian?></p>
                    </li>
                </ul>
            </div>

		<? else : ?>
			Belum ada ujian yang tersedia.
		<? endif?>
</body>
</html>
